package com.lixianbiao.validation.handler;

import com.lixianbiao.validation.compoent.Handler;
import com.lixianbiao.validation.compoent.Message;
import com.lixianbiao.validation.User;

/**
 * @author lixianbiao
 * @since 2024/06/21 21:55
 */
public class UsernameExitsHandler extends Handler<User> {
    // 自定义业务逻辑注解，检测用户名称是否存在
    @Override
    public void doHandler(User member, Message message) throws IllegalAccessException {
        if("admin1234".equals(member.getUsername())){
            message.result = false;
            message.code = 201;
            message.message = "用户名称已存在";
            return;
        }
        if(next != null){
            next.doHandler(member,message);
        }
    }
}